import Vue from 'vue'
import VueRouter from 'vue-router'
// import PersonalityTest from '../views/PersonalityTest.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: () => import('../views/Home.vue')
  },
  {
    path: '/test',
    name: 'Test',
    component: () => import('../views/Test.vue')
  },
  // {
  //   path: '/stage-result/:stageId',
  //   name: 'StageResult',
  //   component: () => import('../views/StageResult.vue'),
  //   props: true
  // },
  {
    path: '/result',
    name: 'Result',
    component: () => import('../views/Result.vue')
  },
  {
    path: '/report',
    name: 'Report',
    component: () => import('../views/Report.vue')
  }
  // {
  //   path: '/detailed-report',
  //   name: 'DetailedReport',
  //   // 使用懒加载方式加载详细报告页面
  //   component: () => import('../views/DetailedReport.vue')
  // },
  // {
  //   path: '/test-dome',
  //   name: 'test-dome',
  //   component: () => import('../views/Test.vue')
  // }
]

const router = new VueRouter({
  // mode: 'history',
  // base: '/',
  routes
})

// 全局导航守卫，用于记录用户页面访问
// import { trackPageView } from '../utils/analytics'

router.beforeEach((to, from, next) => {
  // 记录页面访问
  // trackPageView(to.name);
  next();
})

export default router